<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="functions.asp" -->
 
<%
'set cn=Server.CreateObject("ADODB.Connection")
'cn.Open "MP2ENTTEST2", "MP2", "MP2"
dim sql %>
<%
Dim EXIREG__tmpNum
EXIREG__tmpNum = "0"
if (request.querystring("seqnum") <> "") then EXIREG__tmpNum = request.querystring("seqnum")
%>
<%
set EXIREG = Server.CreateObject("ADODB.Recordset")
EXIREG.ActiveConnection = cn
EXIREG.Source = "SELECT SEQNUM, REGNUM, INVNUM, EMPCODE,VENDORID, PONUM,INVSTATUS, MULTIVERIFY,REFORDER,USERCOORD,INVAMOUNT,INVCURRENCY, (SELECT EXCHANGERATE FROM EXCHRATE WHERE EXCHRATE.MP2CURRENCY=EXIREG.INVCURRENCY) AS FRATE, CURRENCYSYMBOL, DEPARTMENT, INVRECDATE, INVDUEDATE, REFERENCEDOC, (SELECT TOP 1  VENDOR.NAME FROM VENDOR WHERE VENDOR.VENDORID=EXIREG.VENDORID) AS VENDORNAME, WHTAMOUNT, VATRATE, WHTRATE  FROM dbo.EXIREG  WHERE SEQNUM=" + Replace(EXIREG__tmpNum, "'", "''") + ""
'EXIREG.CursorType = 0
'EXIREG.CursorLocation = 2
'EXIREG.LockType = 3
EXIREG.Open()
EXIREG_numRows = 0
%>
<SCRIPT Language = "JavaScript">

function DocLoad(){
sum_all();
}


function sum_all(){
var invamt=document.form1.inv_amt.value;
    invamt=invamt.replace(/,/g,'');
var whtamt=document.form1.wht_amt.value;
    whtamt=whtamt.replace(/,/g,'');
var vatamt=document.form1.vat_amt.value;
    vatamt=vatamt.replace(/,/g,'');
var otheramt=document.form1.other_amt.value;
    otheramt=otheramt.replace(/,/g,'');
var totalamt=Number(invamt)-Number(whtamt)+Number(vatamt)+Number(otheramt);
var stotalamt= totalamt.toString().split('').reverse().join('').replace(/(?=\d*\.?)(\d{3})/g,'$1,').split('').reverse().join('').replace(/^[\,]/,'');
document.form1.total_amt.value=stotalamt;

}
</SCRIPT>
<!-- #include file="pagetop.asp" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr> 
    <td nowrap height="21" bgcolor="#FFFFFF" width="3%" background="images/menu_end.gif">&nbsp;</td>
    <td nowrap height="21" bgcolor="#FFFFFF" width="28"> 
      <div align="center"><img src="images/menu_awal_off.gif" width="28" height="33"></div>
    </td>
    <td width="15%" background="images/menuoff.gif" height="21" nowrap> 
      <div align="center"><b><a href="Inv_Payment.asp?Type=1" class="menu">Invoice 
        List </a></b></div>
    </td>
    <td nowrap height="21" width="28"><img src="images/menu_off_on_separator.gif" width="28" height="33"></td>
    <td width="15%" background="images/menuon.gif" height="21" nowrap> 
      <div align="center"><b class="menu">Invoice Payment</b></div>
    </td>
    <td height="21" bgcolor="#FFFFFF" width="11"><img src="images/Menu_onend.gif" width="13" height="33"></td>
    <td height="21" bgcolor="#FFFFFF" background="images/menu_end.gif"> 
      <div align="right"><font color="#003399"><b>Outstanding Invoice&nbsp;</b></font></div>
    </td>
  </tr>
  <tr bgcolor="#93bee2"> 
    <td height="21" width="3%" bgcolor="#93bee2">&nbsp;</td>
    <td height="21" width="28" bgcolor="#93bee2">&nbsp;</td>
    <td width="15%" height="21" bgcolor="#93bee2">&nbsp;</td>
    <td height="21" width="28">&nbsp;</td>
    <td width="15%" height="21">&nbsp;</td>
    <td height="21">&nbsp;</td>
    <td height="21">&nbsp;</td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#93bee2">
  <tr> 
    <td width="4%" height="14">&nbsp;</td>
    <td width="2%" height="14">&nbsp;</td>
    <td width="94%" height="14">&nbsp; </td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td width="94%">&nbsp;</td>
  </tr>
  <tr> 
    <td width="4%" height="20">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF" height="20"><img src="images/curv_data.gif" width="21" height="21"></td>
    <td bgcolor="#FFFFFF" height="20" width="94%">&nbsp;</td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF" width="94%">&nbsp; </td>
  </tr>
  <tr> 
    <td width="4%">&nbsp;</td>
    <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
    <td bgcolor="#FFFFFF" width="94%"> 
      <form name="form1" method="post" action="Payment_proc.asp" >
        <table width="100%" border="0" cellspacing="2" cellpadding="3">
          <tr> 
            <td width="15%" bgcolor="#dedede" height="26"> 
              <div align="right"><b>Invoice No.:&nbsp;</b></div>
            </td>
            <td width="2%" height="26">&nbsp;</td>
            <td width="30%" height="26"> <%=(EXIREG.Fields.Item("INVNUM").Value)%> 
              <input type="hidden" name="seqnum" value="<%=(EXIREG.Fields.Item("SEQNUM").Value)%>">
            </td>
            <td width="15%" bgcolor="#dedede" height="26"> 
              <div align="right"><b>Invoice Status:&nbsp;</b></div>
            </td>
            <td width="2%" height="26">&nbsp;</td>
            <td height="26"> <%=(EXIREG.Fields.Item("INVSTATUS").Value)%> </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Vendor ID:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25"> <%=(EXIREG.Fields.Item("VENDORID").Value)%> </td>
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Vendor Name:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td bgcolor="#FFFFFF" height="25"><%=(EXIREG.Fields.Item("VENDORNAME").Value)%></td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Reference Order:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25"> 
              <%if(EXIREG.Fields.Item("REFORDER").Value="Y") then %>
              <img src="images/check.jpg" width="18" height="17"> 
              <% else %>
              <img src="images/uncheck.jpg" width="14" height="14"> 
              <% end if %>
            </td>
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>PO/SO/CO No:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td bgcolor="#FFFFFF" height="25" width="36%"> <%=(EXIREG.Fields.Item("PONUM").Value)%> </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Invc. Received Date:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td width="30%" height="25"> <%=(DoDateTime((EXIREG.Fields.Item("INVRECDATE").Value), 1, 2057))%> </td>
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Invc. Due Date:</b>&nbsp;</div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25"><%= DoDateTime((EXIREG.Fields.Item("INVDUEDATE").Value), 1, 2057) %> </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Department:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td height="25">&nbsp; </td>
            <td height="25" bgcolor="#dedede"> 
              <div align="right"><b>Currency:&nbsp;</b></div>
            </td>
            <td height="25"><b></b></td>
            <td height="25"><b><%=(EXIREG.Fields.Item("CURRENCYSYMBOL").Value)%>&nbsp;&nbsp;</b></td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="25"> 
              <div align="right"><b>Original Invoice:&nbsp;</b></div>
            </td>
            <td width="2%" height="25">&nbsp;</td>
            <td colspan="4" height="25"><a href="javascript:opennew('<%=(EXIREG.Fields.Item("REFERENCEDOC").Value)%>')"><%=(EXIREG.Fields.Item("REFERENCEDOC").Value)%></a> </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#FFFFFF"> 
              <div align="right"><b> </b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="button" name="Submit5" value="View Invoice" class="sbttn" onClick="opennew('<%=(EXIREG.Fields.Item("REFERENCEDOC").Value)%>')">
            </td>
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td>&nbsp; </td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Invoice Amount:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="inv_amt" class="NumBox" size="20" value="<%=(FormatNumber((EXIREG.Fields.Item("INVAMOUNT").Value), -1, -2, -2, -1))%>" onBlur="sum_all()">
            </td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>WHT Amount:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td> 
              <input type="text" name="wht_amt" class="NumBox" size="20" value="<%=(FormatNumber((EXIREG.Fields.Item("WHTAMOUNT").Value), -1, -2, -2, -1))%>" onBlur="sum_all()">
            </td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede" height="38"> 
              <div align="right"><b>VAT 10%:&nbsp;</b></div>
            </td>
            <td width="2%" height="38">&nbsp;</td>
            <td width="30%" height="38"> 
              <input type="text" name="vat_amt" class="NumBox" size="20" onBlur="sum_all()" value="<%=(FormatNumber((EXIREG.Fields.Item("VATRATE").Value * EXIREG.Fields.Item("INVAMOUNT").Value/100), -1, -2, -2, -1))%>">
            </td>
            <td width="15%" bgcolor="#FFFFFF" height="38">&nbsp;</td>
            <td width="2%" height="38">&nbsp;</td>
            <td height="38">&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Other:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="other_amt" class="NumBox" size="20" onBlur="sum_all()" value="0">
            </td>
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Total Amount Paid:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="total_amt" class="NumBox" size="20">
            </td>
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Payment Date: </b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td width="30%"> 
              <input type="text" name="Payment_date" size="12" maxlength="12" class="InputBox" value="<%= Date %>">
              <input type="button" name="Submit52" value=" ... " class="sbttn" onClick="javascript:show_calendar('form1.Payment_date')">
            </td>
            <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
            <td width="2%">&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td width="15%" height="18">&nbsp;</td>
            <td width="2%" height="18">&nbsp;</td>
            <td colspan="4" height="18">&nbsp;</td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#dedede"> 
              <div align="right"><b>Action:&nbsp;</b></div>
            </td>
            <td width="2%">&nbsp;</td>
            <td colspan="4"> 
              <input type="submit" name="btnRoute" value="  Save  " class="sbttn">
              <div align="right"><b> </b></div>
            </td>
          </tr>
        </table>
      </form>
    </td>
  </tr>
</table>
</body>
</html>
<%
EXIREG.Close()
%>
